package com.fin.zw.aiqas.controller;

import com.fin.zw.aiqas.annotation.CurrentUser;
import com.fin.zw.aiqas.model.request.DetailReviewQueryRequest;
import com.fin.zw.aiqas.model.response.DetailReviewResponse;
import com.fin.zw.aiqas.model.session.SessionModel;
import com.fin.zw.aiqas.service.DetailReviewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @Author: ZhangGQ
 * @Date: 2019/09/18
 * Description:
 */
@RestController
@RequestMapping("/detailReview")
@Api(value = "复核", description = "复核")
public class DetailReviewController {
    @Autowired
    private DetailReviewService detailReviewService;

    @GetMapping("/fetchPage")
    @ApiOperation(value = "复核分页查询", notes = "复核分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", dataType = "int", paramType = "query", value = "第几页（0 ... N）"),
            @ApiImplicitParam(name = "size", dataType = "int", paramType = "query", value = "每页的大小"),
            @ApiImplicitParam(name = "sort", dataType = "string", paramType = "query", allowMultiple = true, value = "排序：属性名（xxx，asc|desc）"),
    })
    public ResponseEntity<Page<DetailReviewResponse>> fetchPage(DetailReviewQueryRequest reviewQueryRequest, @ApiIgnore @CurrentUser SessionModel sessionModel, Pageable pageable) {
        Page<DetailReviewResponse> detailReviewResponses = detailReviewService.fetchPage(reviewQueryRequest, sessionModel, pageable);
        return ResponseEntity.ok().body(detailReviewResponses);
    }

}
